/**
 * 
 */
package com.rpg.base.flyweight;

/**
 * Equipped item element modifiers. An equipped item can have 0 or more of these
 * modifiers applied; an element that modifies the wielder's strength, an
 * element that modifies the wielder's to-hit score, etc.
 * @author Donald
 */
public final class EquipmentItemModifier {
	/** any flags that have been set. */
	private long	flags;
	/** not used. yet. */
	private int	special;
	/** the value of modifier to be applied. */
	private float	value;
	/** Clears all data. */
	public void clearData() {
		flags = 0;
		special = 0;
		value = 0f;
	}
	/** Clears all flags that were set. */
	public void clearFlags() {
		flags = 0;
	}
	/**
	 * Gets the special.
	 * @return int
	 */
	public int getSpecial() {
		return special;
	}
	/**
	 * Gets the value of modifier to be applied.
	 * @return float
	 */
	public float getValue() {
		return value;
	}
	/**
	 * Determines if the {@link EquipmentItemModifier} has a specific flag.
	 * @param flag the flag
	 * @return true if the {@link EquipmentItemModifier} has the flag; false
	 *         otherwise
	 */
	public boolean hasFlag(final long flag) {
		return (flags & flag) == flag;
	}
	/**
	 * Removes a flag.
	 * @param flag the flag
	 */
	public void removeFlag(final long flag) {
		flags &= ~flag;
	}
	/**
	 * Sets a flag.
	 * @param flag the flag
	 */
	public void setFlag(final long flag) {
		flags |= flag;
	}
	/**
	 * Sets the special.
	 * @param val the special to set
	 */
	public void setSpecial(final int val) {
		special = val;
	}
	/**
	 * Sets the value of modifier to be applied.
	 * @param val the value to set
	 */
	public void setValue(final float val) {
		value = val;
	}
}
